Skip to content

fix: preserve authored $ref+sibling syntax on render (issue #575)#576

Merged
daveshanley merged 4 commits into
mainfrom
issue-575
May 27, 2026
Merged

fix: preserve authored $ref+sibling syntax on render (issue #575)#576
daveshanley merged 4 commits into
mainfrom
issue-575

Conversation

@daveshanley
Copy link
Copy Markdown
Member

When the sibling-ref transformer rewrites a $ref with sibling fields into a synthetic allOf, the model still rendered that allOf back out, changing the authored syntax. Add renderTransformedRefWithSiblings to collapse the synthetic two-element allOf back into the original $ref+sibling shape on MarshalYAML, reusing the low-level TransformedRef node for key ordering and merging in mutated sibling values.

Only the transformer-created allOf is collapsed; authored allOf blocks (or outer schema mutations) keep their explicit allOf so no changes are hidden. Add unit coverage for the new render path and helpers, an issue-575 regression spec, and update document render tests to assert byte-exact round-tripping.

When the sibling-ref transformer rewrites a `$ref` with sibling fields into a synthetic `allOf`, the model still rendered that `allOf` back out, changing the authored syntax. Add `renderTransformedRefWithSiblings` to collapse the synthetic two-element `allOf` back into the original `$ref`+sibling shape on `MarshalYAML`, reusing the low-level `TransformedRef` node for key ordering and merging in mutated sibling values.

Only the transformer-created `allOf` is collapsed; authored `allOf` blocks (or outer schema mutations) keep their explicit `allOf` so no changes are hidden. Add unit coverage for the new render path and helpers, an issue-575 regression spec, and update document render tests to assert byte-exact round-tripping.
@blacksmith-sh

This comment has been minimized.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.69%. Comparing base (5fd8f4f) to head (cc47bc6).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #576      +/-   ##
==========================================
- Coverage   99.72%   99.69%   -0.03%     
==========================================
  Files         280      280              
  Lines       33575    33666      +91     
==========================================
+ Hits        33483    33564      +81     
- Misses         55       64       +9     
- Partials       37       38       +1     
Flag Coverage Δ
unittests 99.69% <100.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@daveshanley daveshanley merged commit 2226fcd into main May 27, 2026
5 checks passed
@daveshanley daveshanley deleted the issue-575 branch May 27, 2026 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant